<?php

namespace decrypt;

class QianYeDeocde
{
	public $key;
	public function decode(&$FileMsg)
	{
		preg_match('/eval\(str_rot13\(\'([\s\S]*?)\'\)\);/', $FileMsg, $data);
		if (!$data[1]) {
			return false;
		}
		$code = str_replace("\'", "'", $data[1]);
		$code = str_replace("\\\\", "\\", $code);
		$code = $key = substr($code, 34);
		$code = substr($code, 32);
		$this->key = substr($key, 0, 32);
		$code = $this->translation($code, $code);
		preg_match('/eval\(gzuncompress\(base64_decode\(\'([\s\S]*?)\'\)\)\);/', $code, $decode);
		$decode = @gzuncompress(base64_decode($decode[1]));
		if (!$decode) {
			return false;
		}
		return '<?php ' . $decode;
	}
	public function translation(&$var_name, $encode, $option = 0)
	{
		global $var_3, $var_7, $var_2, $var_8, $value, $var_10, $var_11;
		$value = '';
		$attach = 0;
		$attach += $option;
		$other = $attach . '';
		if (!$option) {
			$other = $this->key;
		}
		$encode_length = strlen($encode);
		$other_length = strlen($other);
		$num = 0;
		for ($i = 0; $i < $encode_length; $i++) {
			if ($num >= $other_length) {
				$num = 0;
			}
			if ($option == 25) {
				$var_name = $this->translation($var_30);
				return;
			}
			$value .= $other[$num] ^ $encode[$i];
			$num++;
		}
		$var_name = $value;
		return $value;
	}
}
